]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
switcherPopup: Dismiss when a system modal dialog opens
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 6 Dec 2019 12:56:24 +0000 (13:56 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 6 Dec 2019 18:55:39 +0000 (19:55 +0100)
As system modal dialogs may open without user interaction (for instance
polkit or network agent requests), it is possible for them to pop up
while the app/window switcher is up.

The current result of having both up simultaneously is clearly broken,
so we can either dismiss the popup or prevent the modal dialog from
opening. Assume that the dialog indicates a more important action and
should therefore take precedence, so go with the former.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1536

js/ui/layout.js
js/ui/modalDialog.js
js/ui/switcherPopup.js

index 7fb9f2419328d94691dd109828dc52f699a87b88..c7dd6287f7a6fb858ea20d7587a5b293c2c93420 100644 (file)
@@ -189,6 +189,7 @@ var LayoutManager = GObject.registerClass({
                'startup-complete': {},
                'startup-prepared': {},
                'monitors-changed': {},
+               'system-modal-opened': {},
                'keyboard-visible-changed': { param_types: [GObject.TYPE_BOOLEAN] } },
 }, class LayoutManager extends GObject.Object {
     _init() {
index c29b89ba77691e0ab7e8832eb9c4b4af95a31bc5..caa874454ff8723031c8787d6c0cc337b16de0bd 100644 (file)
@@ -219,6 +219,8 @@ var ModalDialog = GObject.registerClass({
         if (!Main.pushModal(this, params))
             return false;
 
+        Main.layoutManager.emit('system-modal-opened');
+
         this._hasModal = true;
         if (this._savedKeyFocus) {
             this._savedKeyFocus.grab_key_focus();
index 48f44c90f726de678f17dd42a7b977344fa309e9..945f4020a5002b181e95047c9656848a2b216ca4 100644 (file)
@@ -46,6 +46,9 @@ var SwitcherPopup = GObject.registerClass({
 
         Main.uiGroup.add_actor(this);
 
+        this._systemModalOpenedId =
+            Main.layoutManager.connect('system-modal-opened', () => this.destroy());
+
         this._haveModal = false;
         this._modifierMask = 0;
 
@@ -319,6 +322,8 @@ var SwitcherPopup = GObject.registerClass({
     _onDestroy() {
         this._popModal();
 
+        Main.layoutManager.disconnect(this._systemModalOpenedId);
+
         if (this._motionTimeoutId != 0)
             GLib.source_remove(this._motionTimeoutId);
         if (this._initialDelayTimeoutId != 0)